//
//  HomeCollectionFooterReusableView.m
//  WanCaiC8
//
//  Created by 罗先森 on 2018/8/30.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "HomeCollectionFooterView.h"
#import "AdvertisingView.h"

@interface HomeCollectionFooterView ()
@property(nonatomic,strong)AdvertisingView *oneAdvertisingView;


@end

@implementation HomeCollectionFooterView


- (instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        
        [self setupUI];
        
        
    }
    return self;
}

-(void)setupUI{

    
    self.backgroundColor=[UIColor whiteColor];

    
    [self addSubview:self.oneAdvertisingView];
    [self.oneAdvertisingView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.equalTo(self);
        make.height.mas_equalTo(@0);
    }];
    
   
}


-(void)setAdModelArr:(NSMutableArray *)adModelArr{

    
    self.oneAdvertisingView.dataArr = adModelArr;
    
    self.oneAdvertisingView.changeHeight(adModelArr.count*40);
    
}

- (AdvertisingView *)oneAdvertisingView{
    if (!_oneAdvertisingView) {
        WS(weakSelf);
        _oneAdvertisingView =[[AdvertisingView alloc]init];
        self.oneAdvertisingView.changeHeight = ^(float height) {
            [weakSelf.oneAdvertisingView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(@(height));
            }];
        };
    }
    return _oneAdvertisingView;
}
@end
